import request from '@/utils/request';

// 获取咨询师
export function getCounselors() {
    return request({
        url: '/system/user/teacherlist',
        method: 'get'
    })
}

// 查询咨询师
export function searchCoundelors(data) {
    return request({
        url: '/system/teacher/list',
        method: 'get',
        data: data
    })
}

// 获取日期时间段
export function getTime() {
    return request({
        url: '/schedule/dateTimeSpans',
        method: 'get'
    })
}

// 某个咨询师的排期
export interface schedule {
    /**
     * 日期
     */
    date?: string;
    id?: string;
    pageNum?: string;
    pageSize?: string;
    [property: string]: any;
}

// 获取排期
export function getSchedule(data:schedule) {
    return request({
        url: '/schedule/list',
        method: 'get',
        params: data
    })
}

//修改排期
export interface updateSchedulesData {
    ids: string; // * 排班id,多个id用,连接
    status?: string;  // * 是否可约
    [property: string]: any;
}
export function updateSchedulesAll(data:updateSchedulesData){
    return request({
        url:'/schedule/editAll',
        method:'put',
        data
    })
}

export interface id {
    id: string;
    [property: string]: any;
}

//获取已约详情
export function getDetails(id:id) {
    return request({
        url: `/scheduling/appointment/${id}`,
        method: 'get'
    })
}

// 取消预约
export interface cancel {
    /**
     * 预约的id
     */
    id: string;
    /**
     * 取消原因
     */
    reason: string;
    [property: string]: any;
}

// 取消预约
export function cancelDetails(data:cancel) {
    return request({
        url: '/appointment/cancel',
        method: 'post',
        data: data
    })
}

// 预约学生列表
export function getStuList(data){
    return request({
        url:'/system/student/allList',
        method: 'get',
        params: data
    })
}

// 提交预约
export interface commit {
    /**
     * 咨询内容
     */
    content?: string;
    /**
     * 咨询方式
     */
    mode: string;
    /**
     * 人数类型，【0，单人】【1，团体】
     */
    peopleType: number;
    /**
     * 排班id
     */
    schedulingId: string;
    [property: string]: any;
}

export function commit(data:commit ) {
    return request({
        url: '/appointment/commit',
        method: 'post',
        data: data
    })
}

// 时间段列表
export function getTimes() {
    return request({
        url: '/time/list',
        method: 'get'
    })
}

// 添加时间段
// export interface addTimes {
//     /**
//      * 结束时间
//      */
//     endTime?: Date;
//     /**
//      * 开始时间
//      */
//     startTime?: Date;
//     [property: string]: any;
// }

export function addTimes(data) {
    return request({
        url: '/time/add',
        method: 'post',
        data: data
    })
}

// 删除时间段
export function delTimes(data){
    return request({
        url: '/time/delete',
        method: 'delete',
        data: data
    })
}

//编辑时间段
export function editTimes(data) {
    return request({
        url: '/time/edit',
        method: 'put',
        data: data
    })
}
